import { Gender } from "../models/enums";
import dayjs from "dayjs";
import { FileService } from "../services";
import { Blist } from "../services/book.service";

export function uniqueFunc(arr: any[] | undefined) {
  const res = new Map();
  return arr?.filter((item) => !res.has(item._id) && res.set(item._id, 1));
}

export function dealGender(sex: Gender) {
  if (sex === Gender.female) return "女";
  if (sex === Gender.male) return "男";
  return "外星人";
}

export function nowDay(time: number) {
  return dayjs(time).format("YYYY-MM-DD HH:mm:ss");
}
